﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace lcmyjobs.Web.enprise
{
    public partial class SearchUserInfo : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Application["webname"] != null)
                {
                    this.Title = string.Format("单位管理中心—简历搜索：系统智能搜索简历  {0}", Application["webname"].ToString());
                }
                if (Session["enterprise_bid"] != null)
                {
                    DataSet ds = new lcmyjobs.BLL.enterprise_basic().GetReleaseJobByBid(Convert.ToInt32(Session["enterprise_bid"]));

                    this.ddl_jobsname.DataSource = ds.Tables[3];
                    this.ddl_jobsname.DataValueField = "enterprise_rid";
                    this.ddl_jobsname.DataTextField = "jobs_name";
                    this.ddl_jobsname.DataBind();

                    if (Session["enterprise_name"] != null)
                    {
                        this.lbl_title.Text = " " + Session["enterprise_name"].ToString();
                    }
                }
                else
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "请您先登陆！", "EnterpriseLogin.html");
                }

            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int type = 0, salary = 0, edu = 0, mtime = 0, exp = 0, lan = 0, level = 0, count = 0;
            string jobs = "", area = "", trade = "", mtimes = "",//到岗时间
                major = "", rtime = "";//刷新时间

            lcmyjobs.BLL.enterprise_releasejob er = new BLL.enterprise_releasejob();

            DataSet ds = er.GetBasicAndJobsInfoByRid(Convert.ToInt32(this.ddl_jobsname.SelectedItem.Value));

            jobs = this.ddl_jobsname.SelectedItem.Text;

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                type = Convert.ToInt32(row["workerclass"]);
                salary = Convert.ToInt32(row["salarym"]);
                edu = Convert.ToInt32(row["edus_id"]);
                //mtime = 0; //到岗时间为不限
                exp = Convert.ToInt32(row["workexp_id"]);//工作经验
                lan = Convert.ToInt32(row["languages_id"]);

                string levelstr = row["languages_level"].ToString();

                switch (levelstr)
                {
                    case "1": level = 1; break;
                    case "2": level = 2; break;
                    case "3": level = 3; break;
                    default: level = 0; break;
                }

                area = row["area_name"].ToString();
                major = row["major_name"].ToString();
            }

            if (ds.Tables[1].Rows.Count > 0)
            {
                DataRow row = ds.Tables[1].Rows[0];

                trade = row["trade_name"].ToString();

                rtime = "";

            }


            lcmyjobs.Model.searchCondition sc = new Model.searchCondition();

            sc.area = area;
            sc.count = count;
            sc.edu = edu;
            sc.exp = exp;
            sc.jobs = jobs;
            sc.lan = lan;
            sc.level = level;
            sc.major = major;
            sc.mtime = mtime;
            sc.mtimes = mtimes;
            sc.rtime = rtime;
            sc.salary = salary;
            sc.trade = trade;
            sc.type = type;


            Session["searchCondition"] = sc;

            Response.Redirect("ListShowUser.html");
        }
    }
}